﻿using System.Text;

namespace iOSClub.App.Share;

[Serializable]
public class StudentModel
{
    public string UserName { get; set; } = "";

    public string UserId { get; set; } = "";

    public string Academy { get; set; } = "";
    public string PoliticalLandscape { get; set; } = "";
    public string Gender { get; set; } = "";
    public string ClassName { get; set; } = "";
    public string PhoneNum { get; set; } = "";
    public string JoinTime { get; set; } = DateTime.Today.ToString("yyyy-MM-dd");

    public override string ToString()
    {
        return $"{UserName},{UserId},{Gender},{Academy},{PoliticalLandscape},{ClassName},{PhoneNum}";
    }

    public StudentModel Standardization(string? time = null)
    {
        UserId = UserId.Replace(" ", "");
        if (string.IsNullOrEmpty(JoinTime))
        {
            JoinTime = string.IsNullOrEmpty(time)
                ? DateTime.Today.ToString("yyyy-MM-dd")
                : time;
        }

        return this;
    }

    public static string GetCsv(List<StudentModel> models)
    {
        var builder = new StringBuilder("姓名,学号,性别,学院,政治面貌,专业班级,电话号码");
        foreach (var model in models)
            builder.Append("\n" + model);

        return builder.ToString();
    }
}

public static class SignRecord
{
    public static readonly string[] ChooseType =
    [
        "姓名",
        "学号",
        "学院",
        "政治面貌",
        "性别",
        "班级",
        "手机号码"
    ];
    
    public static readonly string[] Academies =
    [
        "信息与控制工程学院",
        "理学院",
        "机电学院",
        "建筑学院",
        "机电工程学院",
        "管理学院",
        "土木工程学院",
        "环境与市政工程学院",
        "建筑设备科学与工程学院",
        "材料科学与工程学院",
        "冶金工程学院",
        "资源工程学院",
        "文学院",
        "艺术学院",
        "马克思主义学院",
        "公共管理学院",
        "化学与化工学院",
        "体育学院",
        "安德学院",
        "未来技术学院"
    ];

    public static readonly string[] PoliticalLandscapes =
    [
        "群众",
        "共青团员",
        "中共党员",
        "中共预备党员"
    ];

    public static readonly string[] Genders = ["男", "女"];
}